package com.cf.game.cowboy.handler.model;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * cf-game-StakeItem
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/3/27 14:45
 */
public class StakeItem {

    private String id;

    private String name;

    private double total = 0;

    /**
     * 奖励倍率
     */
    private double bei = 0d;

    /**
     * 用户压得注
     */
    private Map<Integer, UserStake> stakeMap = new ConcurrentHashMap();

    public double getBei() {
        return bei;
    }

    public void setBei(double bei) {
        this.bei = bei;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getTotal() {
        return total;
    }

    public void setTotal(double total) {
        this.total = total;
    }

    public Map<Integer, UserStake> getStakeMap() {
        return stakeMap;
    }

    public void setStakeMap(Map<Integer, UserStake> stakeMap) {
        this.stakeMap = stakeMap;
    }

    public void addUserStake(Integer userId, double money) {
        UserStake userStake = stakeMap.get(userId);
        if (userStake == null) {
            userStake = new UserStake();
            stakeMap.put(userId, userStake);
        }
        //用户对象+钱
        userStake.addMoney(money);
        //总计+钱
        this.total += money;
    }

    @Override
    public String toString() {
        return "StakeItem{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", total=" + total +
                ", bei=" + bei +
                ", stakeMap=" + stakeMap +
                '}';
    }
}
